package com.zky.kafka.consumer;

import com.zky.kafka.domin.User;

import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@Slf4j
public class KafkaConsumer1 {
    @KafkaListener(topics = "test-topic",groupId = "test-group1")
    public void listen(User message) throws Exception {
        if (message.getId().equals("1")) {
            return;
        }
        log.info("-----开始接受message+"+message);
        throw new Exception("手动");
//        System.out.println(("Consumer1 Received message: " + message));
    }

}
